package com.uni.crawl.controller.crawl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.uni.crawl.common.result.PageResult;
import com.uni.crawl.model.query.crawl.CrawlQueuePageQuery;
import com.uni.crawl.model.vo.crawl.CrawlQueueVO;
import com.uni.crawl.service.crawl.CrawlQueueService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "爬虫队列管理接口")
@RestController
@RequestMapping("/api/v1/crawl/queue")
@RequiredArgsConstructor
public class CrawlQueueController {

    private final CrawlQueueService crawlQueueService;

    @Operation(summary = "爬虫队列分页列表")
    @PostMapping("/page")
    public PageResult<CrawlQueueVO> getPage(@RequestBody CrawlQueuePageQuery pageQuery) {
        Page<CrawlQueueVO> result = crawlQueueService.getPage(pageQuery);
        return PageResult.success(result);
    }
}
